<template>
    <h1>个人信息</h1>
    <div v-for="(userinfo, index) in user" :key="index" >
        <div>
            <p>名字：{{ userinfo.username }}</p>
            <p>电话：{{ userinfo.phone }}</p>
            <p>邮箱：{{ userinfo.email }}</p>
            <p>昵称：{{ userinfo.nick_name }}</p>
        </div>

    </div>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue';
import request from '@/request';
let user = ref([])
onMounted(() => {
  request({
    method: 'GET',
    url: 'users/userinfo/'
  }).then(resp => {
    if (Array.isArray(resp.data.users)) {
      user.value = resp.data.users;
      // console.log('用户信息:', resp.data.article_list);
    } else {
      console.error('后端返回的users不是数组类型');
    }
  }).catch(error => {
    console.log('文章显示失败', error);
  });
});

</script>
<style scoped>
</style>